<template>
  <div class="content">
    <div class="header">
      <el-button
        v-if="props.showRefresh"
        :disabled="props.disableRefresh"
        type="primary"
        @click="refreshAction"
        >刷新</el-button
      >
      <el-button
        v-if="props.showSave"
        :disabled="props.disableSave"
        type="primary"
        @click="saveAction"
        >保存</el-button
      >
      <el-button
        v-if="props.showSubmit"
        :disabled="props.disableSubmit"
        type="primary"
        @click="submitAction"
        >提交</el-button
      >
      <el-button
        v-if="props.showCheck"
        :disabled="props.disableCheck"
        type="primary"
        @click="checkAction"
        >审核</el-button
      >
      <el-button
        v-if="props.showUnCheck"
        :disabled="props.disableUnCheck"
        type="primary"
        @click="unCheckAction"
        >反审核</el-button
      >

      <el-button
        v-if="props.showRoll"
        :disabled="props.disableRoll"
        type="primary"
        @click="rollAction"
        >转出</el-button
      >
      <el-button
        v-if="props.showQualifiedWarehousing"
        :disabled="props.disableQualifiedWarehousing"
        type="primary"
        @click="qualifiedWarehousingAction"
        >合格入库</el-button
      >
      <el-button
        v-if="props.showWasteStorage"
        :disabled="props.disableWasteStorage"
        type="primary"
        @click="wasteStorageAction"
        >废品入库</el-button
      >
      <el-button
        v-if="props.showDelete"
        :disabled="props.disableDelete"
        type="primary"
        @click="deleteAction"
        >删除</el-button
      >
      <el-button
        v-if="props.showInitiate"
        :disabled="props.disableInitiate"
        type="primary"
        @click="initiateAction"
        >开工</el-button
      >
      <el-button
        v-if="props.showReworke"
        :disabled="props.disableRework"
        type="primary"
        @click="reworkAction"
        >返工</el-button
      >
      <el-button
        v-if="props.showPause"
        :disabled="props.disablePause"
        type="primary"
        @click="pauseAction"
        >暂停</el-button
      >
      <el-button
        v-if="props.showReport"
        :disabled="props.disableReport"
        type="primary"
        @click="reportAction"
        >报工</el-button
      >
      <!-- <el-button
        v-if="props.showDone"
        :disabled="props.disableDone"
        type="primary"
        @click="doneAction"
        >完工</el-button
      > -->
      <el-button
        v-if="props.showReceive"
        :disabled="props.disableReceive"
        type="primary"
        @click="receiveAction"
        >接收</el-button
      >
      <el-button
        v-if="props.showGet"
        :disabled="props.disableGet"
        type="primary"
        @click="getAction"
        >领料</el-button
      >
      <el-button
        v-if="props.showFirst"
        :disabled="props.disableFirst"
        type="primary"
        @click="firstAction"
        >首检</el-button
      >

      <el-button
        v-if="props.showOutsource"
        :disabled="props.disableOutsource"
        type="primary"
        @click="outsourcingReceiveAction"
        >委外转出</el-button
      >
      <el-button
        v-if="props.showOutsource"
        :disabled="props.disableOutsource"
        type="primary"
        @click="outsourceReceiveAction"
        >委外接收</el-button
      >

      <el-button
        v-if="props.showQuit"
        :disabled="props.disableQuit"
        type="primary"
        @click="quitAction"
        >退出</el-button
      >
      <el-button
        v-if="props.showBack"
        :disabled="props.disableBack"
        type="primary"
        @click="backAction"
        >返回</el-button
      >
    </div>
    <div class="center-body">
      <slot></slot>
    </div>
  </div>
</template>

<script setup lang="ts">
const props = defineProps({
  showOutsource: {
    type: Boolean,
    default: false,
  },
  disableOutsource: {
    type: Boolean,
    default: false,
  },

  showReworke: {
    type: Boolean,
    default: false,
  },
  disableRework: {
    type: Boolean,
    default: false,
  },
  showRefresh: {
    type: Boolean,
    default: true,
  },
  showSave: {
    type: Boolean,
    default: true,
  },
  showSubmit: {
    type: Boolean,
    default: true,
  },
  showCheck: {
    type: Boolean,
    default: true,
  },
  showUnCheck: {
    type: Boolean,
    default: true,
  },
  showQualifiedWarehousing: {
    type: Boolean,
    default: true,
  },
  showWasteStorage: {
    type: Boolean,
    default: true,
  },
  showDelete: {
    type: Boolean,
    default: true,
  },
  showInitiate: {
    type: Boolean,
    default: true,
  },
  showPause: {
    type: Boolean,
    default: true,
  },
  showReport: {
    type: Boolean,
    default: true,
  },
  showDone: {
    type: Boolean,
    default: true,
  },
  showRoll: {
    type: Boolean,
    default: true,
  },
  showReceive: {
    type: Boolean,
    default: true,
  },
  showGet: {
    type: Boolean,
    default: true,
  },
  showFirst: {
    type: Boolean,
    default: true,
  },
  showQuit: {
    type: Boolean,
    default: true,
  },
  showBack: {
    type: Boolean,
    default: true,
  },
  disableRefresh: {
    type: Boolean,
    default: false,
  },
  disableSave: {
    type: Boolean,
    default: false,
  },
  disableSubmit: {
    type: Boolean,
    default: false,
  },
  disableCheck: {
    type: Boolean,
    default: false,
  },
  disableUnCheck: {
    type: Boolean,
    default: false,
  },
  disableQualifiedWarehousing: {
    type: Boolean,
    default: false,
  },
  disableWasteStorage: {
    type: Boolean,
    default: false,
  },
  disableDelete: {
    type: Boolean,
    default: false,
  },
  disableInitiate: {
    type: Boolean,
    default: false,
  },
  disablePause: {
    type: Boolean,
    default: false,
  },
  disableReport: {
    type: Boolean,
    default: false,
  },
  disableDone: {
    type: Boolean,
    default: false,
  },
  disableRoll: {
    type: Boolean,
    default: false,
  },
  disableReceive: {
    type: Boolean,
    default: false,
  },
  disableGet: {
    type: Boolean,
    default: false,
  },
  disableFirst: {
    type: Boolean,
    default: false,
  },
  disableQuit: {
    type: Boolean,
    default: false,
  },
  disableBack: {
    type: Boolean,
    default: false,
  },
});

const emit = defineEmits([
  "refresh",
  "save",
  "submit",
  "check",
  "unCheck",
  "qualifiedWarehousing",
  "wasteStorage",
  "delete",
  "initiate",
  "rework",
  "pause",
  "report",
  "done",
  "roll",
  "receive",
  "get",
  "first",
  "outsourceReceive",
  "outsourcingReceive",
  "quit",
  "back",
]);

/** 刷新 */
const refreshAction = () => {
  emit("refresh");
};

/** 保存 */
const saveAction = () => {
  emit("save");
};

/** 提交 */
const submitAction = () => {
  emit("submit");
};

/** 审核 */
const checkAction = () => {
  emit("check");
};

/** 反审核 */
const unCheckAction = () => {
  emit("unCheck");
};

/** 合格入库 */
const qualifiedWarehousingAction = () => {
  emit("qualifiedWarehousing");
};

/** 废品入库 */
const wasteStorageAction = () => {
  emit("wasteStorage");
};

/** 删除 */
const deleteAction = () => {
  emit("delete");
};

/** 开工 */
const initiateAction = () => {
  emit("initiate");
};

/** 返工工 */
const reworkAction = () => {
  emit("rework");
};

/** 暂停 */
const pauseAction = () => {
  emit("pause");
};

/** 报工 */
const reportAction = () => {
  emit("report");
};

/** 完工 */
const doneAction = () => {
  emit("done");
};

/** 转出 */
const rollAction = () => {
  emit("roll");
};

/** 接收 */
const receiveAction = () => {
  emit("receive");
};

/** 领料 */
const getAction = () => {
  emit("get");
};

/** 首件 */
const firstAction = () => {
  emit("first");
};

/** 首件 */
const outsourceReceiveAction = () => {
  emit("outsourceReceive");
};

/** 首件 */
const outsourcingReceiveAction = () => {
  emit("outsourcingReceive");
};

/** 退出 */
const quitAction = () => {
  emit("quit");
};

/** 返回 */
const backAction = () => {
  emit("back");
};
</script>

<style lang="scss" scoped>
.header {
  background-color: white;
  height: 70px;
  display: flex;
  align-items: center;
  box-shadow: 0px 0px 1px 0px #666;
  padding-left: 20px;
}
.center-body {
  height: calc(100vh - 70px);
  overflow-y: scroll;
  -ms-overflow-style: none; /* IE 和 Edge */
  scrollbar-width: none;
  &::-webkit-scrollbar {
    display: none; /* 隐藏滚动条 */
  }
}
</style>
